Import mojo
Import diddy
Import model
Import linkButton

Class SetDifficultyScreen Extends Screen

	Field linkButtonsList:ArrayList<LinkButton> = New ArrayList<LinkButton>
	
	Method New()
		name = "MainMenuScreen"
		Local button1:LinkButton = LinkButton.Create(game.images.Find("collectStar"),"EASY", SCREEN_WIDTH2+10, SCREEN_HEIGHT2-150,New EasyDifficultyLink(self),0,  0, linkButtonsList)
		Local button2:LinkButton = LinkButton.Create(game.images.Find("collectStar"),"MEDIUM", SCREEN_WIDTH2+10, SCREEN_HEIGHT2-75,New MediumDifficultyLink(self),0, 1, linkButtonsList)
		Local button3:LinkButton = LinkButton.Create(game.images.Find("collectStar"),"HARD", SCREEN_WIDTH2+10, SCREEN_HEIGHT2,New HardDifficultyLink(self),0,  2, linkButtonsList)
		Local button4:LinkButton = LinkButton.Create(game.images.Find("collectStar"),"GENIUS", SCREEN_WIDTH2+10, SCREEN_HEIGHT2+75,New GeniusDifficultyLink(self),0,  3, linkButtonsList)
		Local button5:LinkButton = LinkButton.Create(game.images.Find("collectStar"),"CUSTOM", SCREEN_WIDTH2+10, SCREEN_HEIGHT2+150,New HardDifficultyLink(self),0,  4, linkButtonsList)

		Local button6:LinkButton = LinkButton.Create(game.images.Find("collectStar"),"< BACK", SCREEN_WIDTH2+10, SCREEN_HEIGHT2+215,New BackLink(),0, 5, linkButtonsList)


	End
	
	Method Start:Void()
			LinkButton.StartAll(linkButtonsList)
	End
	
	Method Render:Void()
		Cls
		DrawText("CHOOSE DIFFICULTY:", 5, SCREEN_HEIGHT2,0,0.5)

		LinkButton.DrawAll(linkButtonsList)
	End
	
	Method Update:Void()
	LinkButton.UpdateAll(linkButtonsList)

	End
	
	Method NextScreen:Void()
		if(_model.gameMode = Model.GAME_MODE_BONUS_COUNTING)
			game.nextScreen = _model._bonusCountingScreen
		ElseIf(_model.gameMode = Model.GAME_MODE_BONUS_ODD_EVEN)
			game.nextScreen = _model._bonusOddEvensScreen
		ElseIf(_model.gameMode = Model.GAME_MODE_BONUS_SEQUENCE)
			game.nextScreen = _model._bonusSequenceScreen
		ElseIf(_model.gameMode = Model.GAME_MODE_BONUS_SHOOT)
			game.nextScreen = _model._bonusShootScreen
		ElseIf(_model.gameMode = Model.GAME_MODE_MAIN)
			game.nextScreen = _model._setLevelScreen
		EndIf
		game.screenFade.Start(50, true)
	End
End

Class EasyDifficultyLink Extends ButtonEvent
	Field parent:SetDifficultyScreen
	
	Method New( parent:SetDifficultyScreen)
		Self.parent = parent
	End
	
	Method OnClicked:Void()
		_model.currentDifficulty = Model.DIFFICULTY_EASY		
		parent.NextScreen()
	End
End

Class MediumDifficultyLink Extends ButtonEvent
	Field parent:SetDifficultyScreen
	
	Method New( parent:SetDifficultyScreen)
		Self.parent = parent
	End
	
	Method OnClicked:Void()
		_model.currentDifficulty = Model.DIFFICULTY_MEDIUM
		parent.NextScreen()
	End
End

Class HardDifficultyLink Extends ButtonEvent
	Field parent:SetDifficultyScreen
	
	Method New( parent:SetDifficultyScreen)
		Self.parent = parent
	End
	
	Method OnClicked:Void()
		_model.currentDifficulty = Model.DIFFICULTY_HARD
		parent.NextScreen()
	End
End

Class GeniusDifficultyLink Extends ButtonEvent
	Field parent:SetDifficultyScreen
	
	Method New( parent:SetDifficultyScreen)
		Self.parent = parent
	End
	
	Method OnClicked:Void()
		_model.currentDifficulty = Model.DIFFICULTY_GENIUS
		parent.NextScreen()
	End
End

Class BackLink Extends ButtonEvent
	Method OnClicked:Void()
	if(_model.gameMode = Model.GAME_MODE_MAIN)
		game.nextScreen = _model._mainMenuScreen
	Else
		game.nextScreen = _model._introScreen
	EndIf
	
		game.screenFade.Start(50, true)
	End
End